package com.interview.feign;

import com.interview.pojo.Article;
import com.interview.pojo.Catalogue;
import com.interview.pojo.Title;
import com.interview.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "interview-web")    //绑定需要请求的消费者服务 名称
public interface FeignInterviewService {

    @PostMapping("/article")
    public void add(@RequestBody Article article);


    @DeleteMapping("/article")
    public void del(@RequestBody Article article);

    @PostMapping("/article/up")
    public void up(@RequestBody Article article);

    @GetMapping("/article/queryRecommend")
    public Result<List<Article>> queryRecommend();

    @GetMapping("/article/queryRandom")
    public Result<List<Article>>queryRandom ();

    @GetMapping("/article/queryAll")
    public List<Article> queryAll_Article();
    @GetMapping("/article/count")
    public int queryAll_Count();

    @GetMapping("/article/query")
    public List<Article> query(@RequestParam("catalogue_id") String catalogue_id);

    @GetMapping("/article/query_Name")
    public List<Article> query_Name(@RequestParam("head") String head);

    @GetMapping("/article/articleId")
    public Result<Article> queryID(@RequestParam("articleId") String articleId);

    @GetMapping("/article/count_time")
    public int count_time(@RequestParam("time1") String time1,@RequestParam("time2")String time2);



    @PostMapping("/catalogue")
    public void add(@RequestBody Catalogue catalogue);

    @PostMapping("/catalogue/del")
    public void del(@RequestBody Catalogue catalogue);

    @PostMapping("/catalogue/up")
    public void catalogu_up(@RequestBody Catalogue catalogue) ;

    @GetMapping("/catalogue")
    public Result<List<Catalogue>> queryAll(@RequestParam("titleId") String titleId);


    @GetMapping("/catalogue/queryID")
    public Result<Catalogue> cata_queryID( @RequestParam("catalogueId")  String catalogueId);

    @GetMapping("/catalogue/all")
    public Result<List<Catalogue>> query_select_all();

    @GetMapping("/catalogue/count")
    public int catalogue_count();


    @GetMapping("/solr/soleHighlighting")
    public   List<Map<String, String>> soleHighlighting(@RequestParam("title") String title);


    @PostMapping("/title")
    public void add(@RequestBody Title title);

    @PostMapping("/title/del")
    public void del(@RequestBody Title title);

    @PostMapping("/title/up")
    public void titleup(@RequestBody Title title);


    @GetMapping("/title/query_one")
    public Title title_one(@RequestParam("titleid") String titleid);

    @GetMapping("/title")
    public Result<List<Title>> queryAll();

    @GetMapping("/title/count")
    public int title_count();
}
